package com.etc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etc.dao.OrderDao;

import com.etc.entity.OrderBean;
import com.etc.entity.OrderDetailBean;
import com.etc.entity.PageData;
import com.etc.service.OrderService;

@Service(value="OrderService")
public class OrderServiceImpl implements OrderService{
	@Autowired
	private OrderDao or;
	//分页
	@Override
	public PageData<OrderBean> getOrByPage(int page, int pageSize, String keywords) {
		// TODO Auto-generated method stub
		int start = (page - 1) * pageSize;

		List<OrderBean> data = or.getOrderByPage(keywords, start, pageSize);

		int total = or.getTotalOrder(keywords);
		//PageData<Message> pd = new PageData<>(data, total, pageSize, page);
		PageData<OrderBean> pd=new PageData<>(data, total, pageSize, page);
		return pd;
		
	}
	@Override
	public List<OrderDetailBean> doGetOrderDetal(int orderId) {
		// TODO Auto-generated method stub
		return or.getOrderTail(orderId);
	}
	@Override
	public int doChangeOrderState(int orderId) {
		// TODO Auto-generated method stub
		return or.changeOrderState(orderId);
		
	}
	@Override
	public int doChangeDeskState(int sellerId, String deskName) {
		// TODO Auto-generated method stub
		return or.changeDeskState(sellerId, deskName);
	}

	


}
